package com.sl.plugin.step.db;

import cn.hutool.core.date.DateUtil;
import com.sl.core.engine.meta.impl.AbstractProcessCompDescriptor;
import com.sl.core.engine.step.ProcessCompService;
import com.sl.core.engine.step.impl.AbstractProcessComp;
import lombok.SneakyThrows;

import java.util.Map;

/**
 *
 */
public class DbDefaultValueComp extends AbstractProcessComp<Map<String, Object>, Map<String, Object>> implements ProcessCompService {


    public DbDefaultValueComp(AbstractProcessCompDescriptor abstractProcessCompDescriptor) {
        super(abstractProcessCompDescriptor);
    }

    @SneakyThrows
    @Override
    public Map<String, Object> input(Map<String, Object> map) {

        String userId = this.getPipeline().getVariable("userId");
        map.put("createBy", userId);
        map.put("createTime", DateUtil.date());

        map.put("modifyBy", userId);
        map.put("modifyTime", DateUtil.date());
        map.put("deleted", 0);
        map.put("remark", "初始化");

        return map;
    }

}
